<?php

//欢迎界面
Route::get('/', function () {
    return view('auth.login');
});

//用户登录
Route::group(array('prefix' => 'admin'), function(){

    Route::auth();
});

//system管理
Route::group(array('namespace'=>'Admin\System','prefix' => 'system','middleware'=>'auth'), function(){

    Route::post('/upload','FileController@upload');
    Route::post('/upload_icon','FileController@upload_icon');

    Route::get('/','IndexController@index');

    Route::get('/password','ConfigController@password');
    Route::patch('/password/update_password','ConfigController@update_password');
    Route::get('/edit','ConfigController@edit');
    Route::put('/update/{system}','ConfigController@update');

});

//shop管理 //后台
Route::group(array('namespace'=>'Admin\Shop','prefix' => 'shop','middleware'=>'auth'), function(){

    Route::get('/', 'IndexController@index');

    //brand 品牌管理
    Route::patch('/brand/is_show','BrandController@is_show');
    /*Route::post('/brand/search','BrandController@search');*/
    Route::patch('/brand/sort_order','BrandController@sort_order');
    Route::resource('/brand','BrandController');

    //category 栏目管理
    Route::patch('/goodsCategory/sort_order','goodsCategoryController@sort_order');
    Route::patch('/goodsCategory/is_show','goodsCategoryController@is_show');
    Route::resource('/goodsCategory','goodsCategoryController');


    //product 商品管理
    Route::patch('/product/is_something','ProductController@is_something');
    Route::patch('/product/stock','ProductController@stock');  //ajax修改库存
    Route::delete('/product/destroy_gallery','ProductController@destroy_gallery');

    //删除多选
    Route::delete('/product/destroy_checked','ProductController@destroy_checked');
    Route::get('/product/trash','ProductController@trash'); //显示回收站

    //回收站删除恢复 最后删除
    Route::get('/product/{product}/restore','ProductController@restore'); //回收站恢复单个
    Route::delete('/product/{product}/delete_force','ProductController@delete_force'); //回收站强制删除单个
    Route::get('/product/restore_checked','ProductController@restore_checked'); //回收站恢复多个
    //回收站多选删除没做

    Route::resource('/product','ProductController');

    //customer管理
    Route::get('/customer/index','CustomerController@index');

    //express管理
//    Route::get('/express/index','ExpressController@index');
    Route::patch('/express/is_enable','ExpressController@is_enable'); //是否可用
    Route::patch('/express/sort_order','ExpressController@sort_order'); //排序
    Route::resource('/express','ExpressController');  //改为资源路由



});


//ad管理 //后台
Route::group(array('namespace'=>'Admin\Ad','prefix' => 'ads','middleware'=>'auth'), function(){

    Route::get('/','IndexController@index');
    Route::delete('ad/destroy_checked','AdController@destroy_checked');  //多选删除
    Route::patch('/ad/sort_order','AdController@sort_order');

    //显示回收站
    Route::get('/ad/trash','AdController@trash');

    //回收站删除 还原 最后删除
    Route::get('/ad/{ad}/restore','AdController@restore'); //回收站恢复单个
    Route::delete('/ad/{ad}/delete_force','AdController@delete_force'); //回收站强制删除单个
    Route::get('/ad/restore_checked','AdController@restore_checked'); //回收站恢复多个
    //回收站多选删除没做

    Route::resource('/ad','AdController');

    //广告栏目category
    Route::patch('/category/sort_order','CategoryController@sort_order');
    Route::resource('/category','CategoryController');

});


//前台
//Wechat 管理
Route::group(array('namespace'=>'Home\Wechat','prefix' => 'wechat'), function(){

    Route::get('/','IndexController@index');
    
    Route::get('/product/category','ProductController@category');

});






